<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script>
    window.onload = function () {
      var ele  = document.getElementsByTagName("input");
      ele[4].onclick = function () {
        var year  = Number(ele[0].value);
        var month  = Number(ele[1].value);
        var day  = Number(ele[2].value);
        var days = 0;
        switch(month){
          case 12: days += 30 ;
          case 11: days += 31 ;
          case 10: days += 30 ;
          case 9: days += 31 ;
          case 8: days += 31 ;
          case 7: days += 30 ;
          case 6: days += 31 ;
          case 5: days += 30 ;
          case 4: days += 31 ;
          case 3: 
            if((year % 4==0 && year % 100!=0)||year % 400 ==0){
              days += 29 ;
            }else{
              days += 28 ;
            }
          case 2: days += 31 ;
          case 1: days += day;//当月
          

          // case 12: 
        }
        ele[3].value = days;
      }
    }
  </script>
</head>
<body>
  <input type="text">年
  <input type="text">月
  <input type="text">日是当年的第
  <input type="text">天
  <input type="button" value="确定">
</body>
</html>